typedef struct nodelist{
	IP ip;
	CLIENT *clo;
	uint64_t avail_space;
	//char howbusy;
	uint64_t load;
	struct nodelist *pre;
	struct nodelist *next;
} OSD;

typedef struct client {
	uint32_t ip;
	struct client *next, *pre;
} CLIPER;

typedef struct filelist {
	char path[NAMELEN];
	uint32_t wip;//只能有一个
	uint32_t rcount;
	struct client *rlist;
	uint32_t wcount;
//	struct cilper *wlist;
	struct filelist *pre, *next;
} FILELIST;

int init();
int init_osd_list();
struct nodelist* find_node(IP);
int print_nodelist();
int insert_osd(os_loadreport_in *);
int update_osd(struct nodelist *, os_loadreport_in *);
int sort_nodelist(struct nodelist*);
CLIENT * recreate_clo(IP);
int getoid(const char *, int, char *);
void print_dstat(struct DSTAT *, const char *);
void print_stat(struct stat *, const char *);
void print_meta(const char *);
int Fread(void *, size_t, size_t, FILE *);
int Fwrite(const void *, size_t, size_t, FILE *);
int Fseek(FILE *, long, int);
int update_meta(const char *, uint64_t, const void *, uint32_t);
int insert_file(FILELIST *);
FILELIST * find_file(const char *);
int delete_file(FILELIST *);
int getcid(const uint64_t);
void print_file(FILELIST *);
void print_filelist();

int insert_client(struct client **, struct client *);
CLIPER* find_client(CLIPER *, IP);
int delete_client(CLIPER **, CLIPER *);

